import java.util.Scanner;
public class Shiyan1 {
    //最大公因子
    public static int getGcd(int m, int n) {
        int temp;
        if (m<0&&n<0) return -1;
        else if (m < n) {
            temp = n;
            n = m;
            m = temp;
        } //将较大的数放在前，小数放在后
        if (m % n == 0) return n;
        else return getGcd(n, m % n);
    }

//最小公倍数

    public static int getLcm(int m, int n) {
        if (m<0&&n<0) return -1;
        else return m * n / getGcd(m, n);
}
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入第一个整数:");
        int m = input.nextInt();
        System.out.println("请输入第二个整数:");
        int n = input.nextInt();
        System.out.println("("+m+","+n+")="+getGcd(m,n));
        System.out.println("["+m+","+n+"]="+getLcm(m,n));
    }
}
